{% extends 'TopxiaWebBundle::layout.html.twig' %}

{% block title %}{{'登录'|trans}} - {{ parent() }}{% endblock %}
{% set script_controller = 'auth/login-bind-choose' %}

{% block content %}
<div class="es-section login-section login-section-weixin">
  <div class="section-header">
    <h1>{{ name }}</h1>
  </div>
    <form id="set-bind-new-form" class="form-vertical" method="post" action="{{ path('login_bind_newset', {type:type}) }}" data-goto="{% if hasPartnerAuth %}{{ path('partner_login') }}{% else %}{{ path('homepage') }}{% endif %}">
      <div class="alert alert-danger" id="bind-new-form-error" style="display:none;"></div>
      {% if app.request.get('inviteCode') != null  %}
        <div class="alert alert-info alert-sm">{{'您正在通过<span class="color-gray mhs">%inviteUser%</span>的邀请注册。'|trans({'%inviteUser%': inviteUser.nickname})|raw}}</div>
      {% endif %}
      <div class="form-group mbl">
        <label class="control-label" for="set-bind-nickname-field">{{'头像'|trans}}</label>
        <div class="controls">
          {% if oauthUser.avatar is defined and oauthUser.avatar is not empty %}
            <img class="img-thumbnail" width="120" height="120" src="{{ filepath(oauthUser.avatar, 'avatar.png') }}" />
          {% else %}
            {{'自动获取头像失败，请稍后在自行上传头像'|trans}}
          {% endif %}
        </div>
      </div>
      <div class="form-group mbl">
        <label class="control-label" for="set-bind-nickname-field">{{'用户名'|trans}}</label>
        <div class="controls">
          <input id="set-bind-nickname-field" class="form-control input-lg" type="text" name="nickname" value="{{ oauthUser.name }}" data-url="{{ path('register_nickname_check') }}" />
          <p class="help-block">{{'用户名最长18个英文或者9个汉字'|trans}}</p>
        </div>
      </div>
      {% if setting('login_bind.' ~ type ~ '_set_fill_account') %}
        <div class="form-group mbl">
          <label class="control-label" for="set_bind_email">{{'邮箱地址'|trans}}</label>
          <div class="controls">
            <input id="set_bind_email" class="form-control input-lg" type="email" name="set_bind_emailOrMobile" data-url="{{path('register_email_check')}}">
          </div>
        </div>
      {% endif %}
      <div class="form-group mbl">
        <label id="user_terms">
          <input type="checkbox"  checked="checked">{{'我已阅读并同意'|trans}}<a href="{{ path('user_terms') }}" target="_blank">{{'《服务协议》'|trans}}</a>
        </label>
      </div>

      <div class="form-group clearfix">
        <div class="row">
          <div class="col-xs-6">
            <button id="set-bind-new-btn" class="btn btn-primary btn-lg btn-block" type='submit' data-loading-text="{{'正在登录'|trans}}...">{{'注册帐号'|trans}}</button>
          </div>
          <div class="col-xs-6">
            <a class="btn btn btn-default btn-lg btn-block" href="{{ path('login_bind_change', {type: type}) }}">{{'绑定已有帐号'|trans}}</a>
          </div>
        </div>
      </div>
      <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
      <input type="hidden" name="invite_code" value="{{ app.request.get('inviteCode', '')}}">
    </form>
</div>

{% endblock %}